****************************************************** This code takes checkdata.dta comparing the Stoiber et al data to EP data*  written by the R file "ep_stoiber_check.R", and then counts the *  how many time the data are the same, different*  Cleans data from R so it is read a regular stata data set*  Jonathan Slapin*  Corrects mistakes found in the data. *  February 14, 2006*  Rev: 2/18/06*  Rev: 4/18/06******************************************************clear version 8.2cd "/Users/jslapin/Documents/papers and diss/IO Replication Materials/"insheet using "temp/checkdata.csv", names* checkdata file assumes that if an observation in Stoiber et al. is within 0.5 of the IGC data* the two datasets are the same. created in "ep_stoiber_check.R"* rename variables to match the master datasetsrename v1 issuerename x1 issue1rename x2 KATEG	rename x3 IArename x4	COMrename x5	EPrename x6	Brename x7	DKrename x8	Drename x9	GRrename x10 Erename x11 Frename x12 IRLrename x13 Irename x14 LUXrename x15 NLrename x16 Arename x17 Prename x18 SFrename x19 Srename x20 UKrename x21 SQrename x22 AMreplace COM="." if COM=="NA"replace EP="." if EP=="NA"replace B="." if B=="NA"replace DK="." if DK=="NA"replace D="." if D=="NA"replace GR="." if GR=="NA"replace E="." if E=="NA"replace F="." if F=="NA"replace IRL="." if IRL=="NA"replace I="." if I=="NA"replace LUX="." if LUX=="NA"replace NL="." if NL=="NA"replace A="." if A=="NA"replace P="." if P=="NA"replace SF="." if SF=="NA"replace S="." if S=="NA"replace UK="." if UK=="NA"replace SQ="." if SQ=="NA"replace AM="." if AM=="NA"*  vars read in as strings from R output. Here I switch them back to numeric varsdestring issue COM EP B DK D GR E F IRL I LUX NL A P SF S UK SQ AM, replace* Create a variable which counts how many times observations occur in both datasets* counts how many obs occur in both datasets by issueegen numboth=robs(COM EP B DK D GR E F IRL I LUX NL A P SF S UK SQ AM)*counts how many obs agree in both datasets by issue (number of 1's)egen numagree= neqany(COM EP B DK D GR E F IRL I LUX NL A P SF S UK SQ AM), values(1)egen totalboth=sum(numboth)egen totalagree=sum(numagree)gen percentagree=totalagree/totalbothlist percentagree * redo percentages for mem states only.egen numboth1=robs(B DK D GR E F IRL I LUX NL A P SF S UK)*counts how many obs agree in both datasets by issue (number of 1's)egen numagree1= neqany(B DK D GR E F IRL I LUX NL A P SF S UK), values(1)egen totalboth1=sum(numboth1)egen totalagree1=sum(numagree1)gen percentagree1=totalagree1/totalboth1* create "percent agree" by issuegen peragree=numagree/numbothsum peragreesort peragreelist issue peragree****************************************************************************************************************************************************************************************************** This section of the do file loads the EP taskforce data with some missing values filled in* using the Stoiber et al data and cleans it, outputting a useable stata file.* These missing preferences are filled in the R code  "ep_stoiber_check.R", which must be run* prior to running this section of the do file.clearinsheet using "temp/ams_ep_stoiber.csv", names  //file tranferred to stata using stattransfer* rename variables to match the master datasetsrename v1 issuedrop x1 rename x2 KATEG	rename x3 IArename x4	comrename x5	eprename x6	brename x7	dkrename x8	drename x9	grrename x10 erename x11 frename x12 irlrename x13 irename x14 luxrename x15 nlrename x16 arename x17 prename x18 sfrename x19 srename x20 ukrename x21 sqrename x22 amreplace com="." if com=="NA"replace ep="." if ep=="NA"replace b="." if b=="NA"replace dk="." if dk=="NA"replace d="." if d=="NA"replace gr="." if gr=="NA"replace e="." if e=="NA"replace f="." if f=="NA"replace irl="." if irl=="NA"replace i="." if i=="NA"replace lux="." if lux=="NA"replace nl="." if nl=="NA"replace a="." if a=="NA"replace p="." if p=="NA"replace sf="." if sf=="NA"replace s="." if s=="NA"replace uk="." if uk=="NA"*  vars read in as strings from R output. Here I switch them back to numeric varsdestring issue com ep b dk d gr e f irl i lux nl a p sf s uk sq am, replacesave "temp/ams_ep_stoiber_temp1.dta", replace* change issues 156, 157, 158 based on Stoiber et al. and info in the EP Taskforce report, p25. replace ep=.5 if issue==157 | issue==158replace b=ep if issue==156| issue==157 | issue==158replace nl=ep if issue==156| issue==157 | issue==158replace lux=ep if issue==156| issue==157 | issue==158replace d=1 if issue==157| issue==158replace gr=.5 if issue==157| issue==158replace e=.5 if issue==157| issue==158replace f=d if issue==156| issue==157 | issue==158replace i=.5 if issue==157| issue==158replace a=0 if issue==157replace a=1 if issue==158* replace issue 120 with Stoiber et al. data. These are more sensical and clear herereplace com=. if issue==120 replace ep=. if issue==120replace b =0 if issue==120replace dk=.5 if issue==120replace d =1 if issue==120replace gr=0 if issue==120replace e =1 if issue==120replace f =1 if issue==120replace irl=0 if issue==120replace i=1 if issue==120replace lux=.5 if issue==120replace nl=1 if issue==120replace a=.5 if issue==120replace p=0 if issue==120replace sf=0 if issue==120replace s=0 if issue==120replace uk=1 if issue==120replace sq=0 if issue==120replace am=0 if issue==120* Fix mistakes on number of commissioner issues. * These preferences were checked against the white paper positionsreplace gr=0 if issue==121replace a=0 if issue==121* replace issue 165 with Stoiber et al. data combined with EP Taskforce.*  Koenig data is coded wrong.* The Stoiber data closely matches data in the EP Taskforcereplace com=. if issue==165 replace ep=.5 if issue==165replace b =0 if issue==165replace dk=. if issue==165replace d =0 if issue==165replace gr =.5 if issue==165replace e =0 if issue==165replace f =1 if issue==165replace irl=1 if issue==165replace i=1 if issue==165replace lux=. if issue==165replace nl=. if issue==165replace a=0 if issue==165replace p=1 if issue==165replace sf=1 if issue==165replace s=. if issue==165replace uk=. if issue==165replace sq=1 if issue==165replace am=1 if issue==165* recode 117. SQ should be 0, not 1recode com ep b dk d gr e f irl i lux nl a p sf s uk sq am (0=1) (1=0) if issue==117replace dk=0 if issue ==117  // This follows Denmark's statement in the white paperreplace sf=0 if issue ==117  * Fix 118. Use Austrian position from Stoiber data. More in line* with statements in the white paper IIreplace a=0 if issue==118* Fix 122. Commissionersreplace d=1 if issue==122 //missing filled in from Stoiberreplace f=1 if issue==122  //missing filled in from Stoiberreplace sq=1 if issue==122replace am=1 if issue==122* recode issue 122. SQ is the non integrationalist positionrecode com ep b dk d gr e f irl i lux nl a p sf s uk sq am (0=1) (1=0) if issue==122* Fix 211. CFSP budget. Here Stoiber coding of SQ and AM makes more sense* given changes made in the treaty. I leave Germany and France positions as they * are in the EP taskforce data. They are among the least integrationalist states listed in * the Stoiber/Pappi data, so I feel this is justified.replace sq=0 if issue==211replace am=1 if issue==211* fill in Germany's position for 44 and 45. replace d=0 if issue==44|issue==45/************************************************************************************Issues left unchanged. In all cases the EP data is superior or there is no informationto suggest that the Stoiber et al. data is better than the EP Taskforce information791433010312892266112211858310817318314236516820656332022526284839110204224276276388*****************************************************************************/sort issuesave "temp/ams_ep_stoiber_temp2.dta", replace* merge the marks steenbergen issue areas into the new data* load, sort and re-save the data with the marks steenbergen positions.use amsterdam_msissue.dtasort issue save "temp/amsterdam_msissue.dta", replace*use the new data and merge with the positionsuse  "temp/ams_ep_stoiber_temp2.dta", clearsort issuemerge issue using "temp/amsterdam_msissue.dta"drop _merge* change issue area problemsreplace asylum=. if issue==157|issue==158replace other =1 if issue==157|issue==158replace asylum=1 if issue==39replace epms=. if issue==39save "temp/ams_jbs_temp", replace